package com.zhuoyue.biz.core.api.dao;

import java.util.List;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhuoyue.biz.core.api.domain.GatewayDO;
import org.apache.ibatis.annotations.Select;

/**
 * @author wjming
 * @ClassName: GatewayDao
 * @Description: 网关对象信息
 * @Date 2021-07-08 13:41
 */
public interface GatewayDao extends BaseMapper<GatewayDO> {

    /**
     * 查询家庭中的网关列表
     *
     * @param homeId
     * @return
     */
    List<GatewayDO> selectGatewayListByHomeId(String homeId);


    /**
     * 选择修改网关信息
     *
     * @param gateway
     * @return
     */
    int updateGatewaySelective(GatewayDO gateway);

    /**
     * 根据主键查询
     *
     * @param id
     * @return
     */
    GatewayDO selectGatewayById(String id);

    /**
     * 删除家庭中的网关
     *
     * @param homeId
     * @return
     */
    int deleteGatewayByHomeId(String homeId);

    /**
     * 查询家庭ID通过网关MAC地址
     *
     * @param gatewayMac
     * @return
     */
    @Select("select home_id from tbl_gateway where zigbee_mac=#{gatewayMac}")
    String selectHomeIdByGatewayMac(String gatewayMac);
}
